<template>
  <!--商户端  问题反馈 列表 -->
  <div class="app-container">
    <div class=" ">
      <el-form class="search-form-new" :model="queryParams" ref="queryForm" :inline="true"  label-width="80" >
        <el-form-item label="店铺" prop="tenantId" v-hasPermi="['searchTenantID']">
          <el-select
            v-model="queryParams.tenantId"
            placeholder="请选择店铺"
            clearable
            filterable
          >
            <el-option
              v-for="dict in tenantList"
              :key="dict.tenantId"
              :label="dict.tenantName"
              :value="dict.tenantId"
            />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search"  @click="getList" v-hasPermi="['searchTenantID']">搜索</el-button>
          <el-button type="success" icon="el-icon-plus"  @click="openAdd" >新增</el-button>

        </el-form-item>
      </el-form>
      <div class="table_box">
        <el-table stripe :data="tableData.records"  style="width: 100%">
          <el-table-column label="序号" prop="id" width="60"/>
          <el-table-column label="店铺名称" prop="tenantName" />
          <el-table-column label="联系电话" prop="lianxifangshi" />
          <el-table-column label="反馈时间" prop="createTime" width="160"/>
          <el-table-column label="反馈类型" prop="type" ></el-table-column>
          <el-table-column label="反馈内容" prop="content"  show-overflow-tooltip/>
          
          <el-table-column label="处理结果" prop="result"  show-overflow-tooltip/>
          <el-table-column label="操作" min-width="130" prop="" >
            <template slot-scope="scope">
              <div>
                <el-button type="text" @click="viewDetail(scope.row.id)">详情</el-button>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <pagination v-show="tableData.total > 0" :total="tableData.total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
    </div>
    <addDialog ref="addDialog"></addDialog>
    <viewAndResult ref="viewAndResult"></viewAndResult>
  </div>
</template>

<script>
import fankuiApi from "@/api/PCWebImages/fankui.js";
import addDialog from "./add.vue"
import viewAndResult from "./viewAndResult.vue"
export default {
  name: "",
  components: {addDialog,viewAndResult },
  data() {
    return {
      tableData: {
        records: [],
        total: 0
      },
      queryParams:{
        pageNum:1,
        pageSize:10,
      },
      loading: false,
      typeObj:{
        1:'改进建议',
        2:'问题反馈',
        3:'投诉举报',
      },
      typeOptions: [
        {
          name: '改进建议',
          id: 1
        },
        {
          name: '问题反馈',
          id: 2
        },
        {
          name: '投诉举报',
          id: 3
        },
      ],
      actived: "1",
    };
  },
  computed: {
    tenantList() {
      return this.$store.getters.tenantList
    }
  },
  created() {
    this.getList();
    // this.getTypeList();
  },
  activated() {
    this.getList();
  },
  methods: {
    // 获取列表
    getList() {
      this.tableData.records = [];
      this.loading = true;
      fankuiApi
        .getProblemFeedbackList(this.queryParams)
        .then(response => {
          //console.log("%c Line:111 🥑 response", "color:#42b983", response);
          this.$nextTick(() => {
            this.loading = false;
            this.tableData.records = response.rows
            this.tableData.total = response.total;
          });
        })
        .catch(err => {
          this.loading = false;
        });
    },
    // 查看
    viewDetail(id){
      this.$refs.viewAndResult.open(id)
    },
    // 搜索
    search() {
      this.getList();
    },
    // tabs切换时触发
    tabChange() {
      this.search();
    },
    // 新增
    openAdd() {
      this.$refs.addDialog.open("add");
    },
    // 双击编辑
    handleUpdate(row) {
      // 查看详情
      this.$refs.detailDialog.open(row);
    },
    // 删除记录
    delItem(row) {
      this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          fankuiApi.delImage(row.id).then(res => {
            this.$message({
              type: "success",
              message: "删除成功!"
            });
            this.getList()
          });
        })
        .catch(() => { });
    },

  }
};
</script>
<style lang="scss" scoped></style>
